package java_1_12.book_management.book;

/**
 * 书本实体类
 */
public class Book {
    //书名
    private String bookName;
    //作者
    private String author;
    //价格
    private double price;
    //书籍类别
    private String type;
    //书籍借阅状态-默认都是false
    private boolean isBorrowed;
    //构造方法-isBorrowed不用穿，它默认是未借出状态
    public Book(String bookName, String author, double price, String type) {
        this.bookName = bookName;
        this.author = author;
        this.price = price;
        this.type = type;
    }
    //调用类提供的getter,setter的方法调用修改private修饰的内容
    //getter方法：书本这个类中这些属性都需要被外界取得，都需要getter方法
    public String getBookName() {
        return bookName;
    }
    public String getAuthor() {
        return author;
    }
    public double getPrice() {
        return price;
    }
    public String getType() {
        return type;
    }
    public boolean isBorrowed() {
        return isBorrowed;
    }
    //setter方法：只有需要修改的属性才需要提供setter：price type 借阅状态可以改
    public void setPrice(double price) {
        this.price = price;
    }
    public void setType(String type) {
        this.type = type;
    }
    public void setBorrowed(boolean borrowed) {
        isBorrowed = borrowed;
    }

    @Override
    public String toString() {
        return "Book{" +
                "bookName='" + bookName + '\'' +
                ", author='" + author + '\'' +
                ", price=" + price +
                ", type='" + type + '\'' +
                ", isBorrowed=" + isBorrowed +
                '}';
    }
}
